package zero.tech.games.gate.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import zero.tech.games.entity.games.Club;

public interface ClubMapper {
	@Select("select t2.* from club_member t1 left join club t2 on t1.club_id=t2.club_id where t1.uid=#{uid}")
	List<Club> loadClubListByUid(@Param("uid")int uid);
	@Select("select * from club where club_id=#{club_id}")
	Club getClub(@Param("club_id")int club_id);
	@Insert("insert into club(club_name,club_notice,club_creater_uid,club_creater_nick,club_creater_head_img) "
			+ "values(#{club_name},#{club_notice},#{club_creater_uid},#{club_creater_nick},#{club_creater_head_img})")
	@Options(useGeneratedKeys = true,keyProperty = "club_id")
	void insert(Club club);
	
	@Update("update club set club_notice=#{notice} where club_id=#{club_id}")
	void updateNotice(@Param("club_id")int club_id, @Param("notice")String notice);

}
